#pragma once
#include "afxwin.h"
	#include "id3\tag.h"
#include "album.h"
#include "remoteHost.h"
#include "player.h"
#include "winamp5.h"
#include "winmedia.h"
#include "albumstab.h"
#include "resizablepage.h"
#include "ID3Tags.h"
#include "iTunes.h"

// CID3Tab dialog
UINT RepairAllThread( LPVOID pParam );

class CID3Tab : public CResizablePage
{
	DECLARE_DYNAMIC(CID3Tab)

public:
	CID3Tab(CPrefTab *prefs);
	virtual ~CID3Tab();

// Dialog Data
	enum { IDD = IDD_ID3TAB };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	int FindPlayer(void);
	CWinamp5 _winamp5;
	CWinMedia _winMedia;
	CiTunes _iTunes;

	CEdit _operationStatus;
	CEdit _musicFile;
	CEdit _trackNum;
	CString _trackNumData;
	CEdit _newTrackNum;
	CEdit _title;
	CEdit _newTitle;
	CString _titleData;

private:
	CEdit _artist;
public:
	CEdit _newArtist;
	CString _artistData;
	CEdit _album;
	CEdit _newAlbum;
	CString _albumData;
	CEdit _year;
	CEdit _newYear;
	CString _yearData;
	CEdit _genre;
	CEdit _newGenre;
	CString _genreData;
	CEdit _comment;
	CEdit _newComment;
	CString _commentData;
	CEdit _copyright;
	CEdit _newCopyright;
	CString _copyrightData;
	CEdit _url;
	CEdit _newURL;
	CString _urlData;
	CEdit _encodedBy;
	CEdit _newEncodedBy;
	CString _encodedData;

	ID3_Tag	theTag;
	CID3Tags _tags;
	Album	*_currentAlbum;


private:
	void setTag(ID3_FrameID frameID, ID3_FieldID fieldID, CString tagValue);

public:
	afx_msg void OnBnClickedPrevious();
	afx_msg void OnBnClickedRepair();
	afx_msg void OnBnClickedNext();
	afx_msg void OnBnClickedRRAll();
	afx_msg void OnBnClickedRename();

private:
	int readTag(CString fileName);
private:
	int displayCurrentInfo(void);
public:
	CString _fileName;
	afx_msg void OnPaint();

private:
	int clearID3(void);

public:
	int setProposal(Album* currentAlbum);
private:
	int displayProposal(void);
public:
	int setResult(Album* currentAlbum);

private:
	int clearProposal(void);
public:
    CAxWindow *m_pView;
	CPrefTab* _prefs;

private:
	int renameSong(void);
private:
	int repairSong(void);
private:
	int readProposal(void);
public:
	void OnRepairAll(void);
	void OnRenameAll(void);
	void OnRepairRenameAll(void);
	CPlayer* _player;
	virtual BOOL OnInitDialog();
	afx_msg void OnDestroy();
	int initPointers(CAlbumsTab* albumsTab);
	CAlbumsTab* _albumsTab;
	CString getTitleName(void);
	void RepairAll(void);
	CButton _lockFields;
	CButton _lockV2Fields;
	afx_msg void OnBnClickedLockFields();
	int initWMP(void);
	int destroyWMP(void);
	int _showRegistration;
};
